<?php
namespace app\api\controller;

use app\admin\model\Config;
use app\api\model\GoodsModel;
use app\api\model\MemberModel;
use app\common\model\Upload;
use think\Controller;
use think\Request;


class Common extends Api
{
    protected $noNeedLogin = ['*'];



    public function getConfig(){
        $where[] = ['id','in',[19,20,21,22,24,25]];
        $config = (new Config())->where($where)->column('value','name');
        foreach ($config as &$value){
            $value = (new GoodsModel())->get_img_thumb_url($value,\config('app.image_url'));
        }
        return $this->success('获取成功',$config);
    }


    public function upload(){
        $file = request()->file('file');
        $data = \app\api\model\Upload::uploadImages($file);
        $data['code'] == 200 ? $this->success($data['msg'],$data['data']) : $this->error($data['msg']);
    }



}
